<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
    xmlns:s="http://jboss.org/schema/seam/taglib"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:p="http://primefaces.org/ui" 
    template="/layout/template.xhtml">

<ui:define name="body">

    <h:form id="simuladoSearch" styleClass="edit">

        <p:panel header="Simulado Search Filter" switchType="ajax">

            <s:decorate template="/layout/display.xhtml">
                <ui:define name="label">Descrição</ui:define>
                <p:inputText id="descricao" value="#{simuladoList.simulado.descricao}"/>
            </s:decorate>

            <s:decorate template="/layout/display.xhtml">
                <ui:define name="label">Match</ui:define>
                <p:selectOneRadio id="logic" value="#{simuladoList.restrictionLogicOperator}" styleClass="radio">
                    <f:selectItem itemLabel="E" itemValue="and"/>
                    <f:selectItem itemLabel="OU" itemValue="or"/>
                </p:selectOneRadio>
            </s:decorate>

        </p:panel>

        <div class="actionButtons">
            <p:commandButton id="search" value="Search" action="/pages/SimuladoList.xhtml"/>
            <p:button id="reset" value="Reset" includePageParams="false"/>
        </div>

    </h:form>

    <p:panel>
        <f:facet name="header">Simulado encontrados (#{empty simuladoList.resultList ? 0 : (simuladoList.paginated ? simuladoList.resultCount : simuladoList.resultList.size)})</f:facet>
    <div class="results" id="simuladoList">

    <h:outputText value="Nenhum Simulado encontrado."
               rendered="#{empty simuladoList.resultList}"/>

    <p:dataTable id="simuladoList"
                var="_simulado"
              value="#{simuladoList.resultList}"
           rendered="#{not empty simuladoList.resultList}" liveResize="true">
        <p:column >
            <f:facet name="header">
                <ui:include src="/layout/sort.xhtml">
                    <ui:param name="entityList" value="#{simuladoList}"/>
                    <ui:param name="propertyLabel" value="Id"/>
                    <ui:param name="propertyPath" value="simulado.id"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_simulado.id}"/>
        </p:column>

        <p:column>
            <f:facet name="header">
                <ui:include src="/layout/sort.xhtml">
                    <ui:param name="entityList" value="#{simuladoList}"/>
                    <ui:param name="propertyLabel" value="Descrição"/>
                    <ui:param name="propertyPath" value="simulado.descricao"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_simulado.descricao}"/>
        </p:column>
        <p:column>
            <f:facet name="header">
                <ui:include src="/layout/sort.xhtml">
                    <ui:param name="entityList" value="#{simuladoList}"/>
                    <ui:param name="propertyLabel" value="Dinâmica"/>
                    <ui:param name="propertyPath" value="simulado.dinamica"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_simulado.dinamica}"/>
        </p:column>
        <p:column>
            <f:facet name="header">
                <ui:include src="/layout/sort.xhtml">
                    <ui:param name="entityList" value="#{simuladoList}"/>
                    <ui:param name="propertyLabel" value="Disponível Até"/>
                    <ui:param name="propertyPath" value="simulado.disponivel_ate"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_simulado.disponivel_ate}">
                <s:convertDateTime type="both" dateStyle="short"/>
            </h:outputText>
        </p:column>
        <p:column>
            <f:facet name="header">
                <ui:include src="/layout/sort.xhtml">
                    <ui:param name="entityList" value="#{simuladoList}"/>
                    <ui:param name="propertyLabel" value="Questões"/>
                    <ui:param name="propertyPath" value="simulado.quantidade_questao"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_simulado.quantidade_questao}"/>
        </p:column>
        <p:column>
            <f:facet name="header">
                <ui:include src="/layout/sort.xhtml">
                    <ui:param name="entityList" value="#{simuladoList}"/>
                    <ui:param name="propertyLabel" value="Status"/>
                    <ui:param name="propertyPath" value="simulado.status.descricao"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_simulado.status.descricao}"/>
        </p:column>
        <p:column>
            <f:facet name="header">
                <ui:include src="/layout/sort.xhtml">
                    <ui:param name="entityList" value="#{simuladoList}"/>
                    <ui:param name="propertyLabel" value="Tempo"/>
                    <ui:param name="propertyPath" value="simulado.tempo_reposta"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_simulado.tempo_reposta}"/>
        </p:column>
        <p:column>
            <f:facet name="header">
                <ui:include src="/layout/sort.xhtml">
                    <ui:param name="entityList" value="#{simuladoList}"/>
                    <ui:param name="propertyLabel" value="Data criação"/>
                    <ui:param name="propertyPath" value="simulado.dataCriacao"/>
                </ui:include>
            </f:facet>
            <h:outputText value="#{_simulado.dataCriacao}">
                <s:convertDateTime type="both" dateStyle="short"/>
            </h:outputText>
        </p:column>        
        
        <p:column styleClass="action">
            <f:facet name="header"></f:facet>

            <p:link outcome="/pages/SimuladoEdit.xhtml"
                   value="Edit"
             propagation="none"
                      id="simuladoEdit"
                rendered="#{empty from}" styleClass="btn btn-default btn-sm active">
                <f:param name="simuladoId"
                        value="#{_simulado.id}"/>

                 <span class="glyphicon glyphicon-edit"></span>
            </p:link>
        </p:column>
 
    </p:dataTable>

    </div>
    </p:panel>



    <s:div styleClass="actionButtons" rendered="#{empty from}">
        <p:button outcome="/pages/SimuladoEdit.xhtml"
                    id="create"
           propagation="none"
                 value="Novo Simulado">

        </p:button>
    </s:div>

</ui:define>

</ui:composition>
